import { Entity, Column, PrimaryGeneratedColumn, UpdateDateColumn, ManyToOne, JoinColumn, OneToMany } from 'typeorm';
import { ApiProperty} from '@nestjs/swagger';
import { CommentPicture } from './comment_picture.entity';
import { IsOptional } from 'class-validator';

@Entity()
export class Comment {
  @PrimaryGeneratedColumn()
  id: number;

  @IsOptional()
  @ApiProperty()
  @Column({type: 'tinyint', nullable: false, comment:"类型"})
  type_id: number;

  @IsOptional()
  @ApiProperty()
  @Column({type: 'varchar'})
  value_id: number;

  @IsOptional()
  @ApiProperty()
  @Column({type: 'varchar', length: 6550})
  content: string;

  @Column({type: 'bigint'})
  add_time: number;

  @IsOptional()
  @ApiProperty()
  @Column({type: 'tinyint'})
  status: number;

  @Column({type: 'int'})
  user_id: number;

  @IsOptional()
  @ApiProperty()
  @OneToMany(type => CommentPicture, commentPicture => commentPicture.comment,{
    cascade:true
  })
  commentPicture: CommentPicture[];
}
